package hive.jdbc.getEmpInfo.empController;

import hive.jdbc.getEmpInfo.empService.EmpHiveService;
import hive.jdbc.getEmpInfo.empService.EmpMysqlService;

import java.util.List;
import java.util.Map;

public class EmpController {

    EmpHiveService ehs = new EmpHiveService();
    EmpMysqlService ems = new EmpMysqlService();

    /**
     * 作为此逻辑的调度器
     */
    public void getEmpInfo(){

        //从hive中获取数据
        List<Map<String,Object>> empsList = ehs.getEmpInfoByHive();

//        System.out.println(empsList);

        //把数据写入到mysql中
        int addEmpCount = ems.setEmpInfoToMysql(empsList);
        System.out.println("hive中查询到"+empsList.size()+"条记录，" +
                "成功插入到mysql "+addEmpCount+"条");
    }

    public static void main(String[] args) {
        new EmpController().getEmpInfo();
    }

}
